#include <iostream>
using namespace std;

int money;

int main() {
    int rest = 0, res = 0, money, sum = 0;
    for (int i = 1; i <= 12; i++) {
        cin >> money;
        rest += 300;
        if (rest < money) {
            res =-i; break;
        }
        rest -= money;
        sum += rest / 100 * 100;
        rest -= rest / 100 * 100;
    }
    if (res < 0) cout << res << endl;
    else cout << sum * 1.2 + rest << endl;
    return 0;
}